<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>子页面</title>
</head>

<body>

    <button data-qt-tab-url='welcome.html?page=child' data-qt-tab-title='添加用户信息'
        data-qt-parent-target="#qtab2">给#qtab2添加Tab</button>
    <button data-qt-tab-url='welcome.html?page=child' data-qt-tab-title='添加用户信息'
        data-qt-parent-target="#qtab3">给#qtab3添加Tab</button>
    <button id="btn">通过实例方法addTab()给#qtab2添加Tab</button>
    <button id="btn2">通过实例方法addTab()给#qtab3添加Tab</button>

    <script>
        document.getElementById('btn').addEventListener('click', function () {
            //得到实例对象
            const qtab2 = parent.Quicktab.get('qtab2')
            qtab2.addTab({
                title: '添加商品',
                url: 'welcome.html?page=shop'
            })
        })

        document.getElementById('btn2').addEventListener('click', function () {
            
            //链式调用
            parent.Quicktab.get('qtab3').addTab({
                title: '添加角色',
                url: 'welcome.html?page=role'
            })

        })
    </script>
</body>

</html>